Repository navigation
D-ADD-PM: Codec9 P × M lanes added in place (lab example) - #430
Merged
Merged
Conversation
…e (D-ADD-PM lab) Sign-magnitude addition of Codec9 / DR512 lanes 64 at a time on the U8x64 facade, with no decode to a signed integer: untouched is the identity, a touched zero is +0, and the same-polarity lanes whose sum passes 255 come back as a carry mask instead of saturating silently. Tests: every 512 x 512 codeword pair against an i32 oracle, equality with the decode path, associativity off the carry lanes, and a fold that escapes carry lanes into a wide tally and stays exact. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
…on presence The never-touched code is a zero magnitude, so untouched + x = x is the sign-magnitude addition itself (a disable run removing the identity step stayed green, because the step was dead). Only the zero-to-+0 rule needs presence: two never-touched inputs must stay never touched. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01XAqKMNZqKXSaeb9g2ypywF
Contributor
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
AdaWorldAPI
marked this pull request as ready for review
November 15, 2026 04:48
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lab-only: an example and a test file. Nothing changes in
codec9, the SIMD facade or any backend.What
examples/add_pm/pm.rsprovidesadd_pm(a, b) -> (lanes, carry). It adds two blocks of 64 DR512 lanes (aU8x64of magnitudes plus au64presence word) directly in sign-magnitude form, without decoding to a signed integer:M = sat(M_a + M_b)andP = P_a. The carry mask marks the lanes whereM_a > 255 − M_b. It is the exact-escape signal that Codec9's encoder lacks, since the encoder saturates silently.M = max − min, andPcomes from the larger magnitude.+0when either input was touched. Two never-touched inputs stay never touched.Finding: no identity blend is needed. The never-touched code is a zero magnitude, so
untouched ⊕ x = xfalls out of the addition itself. A disable run that removed the first version's identity step stayed green, because the step was dead, so it's gone. Presence matters in only one place: the zero-to-+0 rule.Tests (
tests/add_pm.rs, all green)i32oracle. There are 65,280 carry pairs, exactly the touched same-polarity pairs with |a| + |b| > 255.add_pmis bit-identical to the decode → i32 → encode path.+0.i64sum.Each of four disable controls turns at least three tests red: no +0 normalization, normalization not gated on presence, carry forced to 0, and opposite polarity taking the smaller magnitude's sign.
Cost (ns per 64 lanes, best of 50, same host)
add_pmavx512bw=true)--config .cargo/config-v3.toml)On AVX2,
add_pmis slower than the decode path because the AVX2U8x64is array-backed: itsmask_blend,saturating_addandsaturating_subare per-byte scalar loops, already on the facet-stride burn-down list. The AVX2 row is a v3 build running on an AVX-512 machine, not AVX2 silicon.Doc:
.claude/knowledge/add-pm-probe.md. Blackboard entry added.Generated by Claude Code